<template>
<div class=''>
  <div class="details-box-top">
    <h3>日程信息</h3>
    <el-row :gutter="10">
      <el-col :md="22">
        <common-calender @changeMonth="changeMonth" :markDate='marked'/>
      </el-col>
    </el-row>
  </div>
</div>
</template>

<script>
import CommonCalender from './calender'
export default {
  name: 'Calender',
  data() {
    return {
       marked: [], // 被选中的日期
       yearMonth: '', // 切换的月份
    };
  },
  methods: {
     // 获取后台要展示的日历日期
    async getTaskDate(id) {
      const data = await this.axios.get('/api/blade-business/dept-group-sche/list', {
        params: {
          groupid: id,
          yearMonth: this.yearMonth
        }
      })
      if(data.data.code == '200') {
        this.marked = data.data.data
        console.log(data.data.data)
      }
    },
    // 获取切换日历
    changeMonth(day) {
      const dates = day.replace(/\//g, '-')
      let yearM = dates.substring(0,dates.length-2) // 去除后俩位
      this.yearMonth = yearM
      console.log(yearM)
      this.getTaskDate(this.teamsId)
    },
  }
}
</script>
<style lang='scss' scoped>

</style>